package com.mobicartel.androidto;

import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;

public class Main extends TabActivity implements OnTabChangeListener {
	
	TabHost tabHost;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.tabs);
		 
        tabHost = getTabHost(); 
        TabHost.TabSpec spec; 
        Intent intent; 
        

        intent = new Intent().setClass(this, DashboardActivity.class);
        spec = tabHost.newTabSpec("dashboard").setIndicator(
                new MyView(this, R.drawable.dash_switcher)
                ).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, NavActivity.class);
        spec = tabHost.newTabSpec("navigate").setIndicator(
                new MyView(this, R.drawable.nav_switcher)
                ).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, DashboardActivity.class);
        spec = tabHost.newTabSpec("sessions").setIndicator(
                new MyView(this, R.drawable.session_switcher)
                ).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, DashboardActivity.class);
        spec = tabHost.newTabSpec("notes").setIndicator(
                new MyView(this, R.drawable.notes_switcher)
                ).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, DashboardActivity.class);
        spec = tabHost.newTabSpec("augmented_reality").setIndicator(
                new MyView(this, R.drawable.augment_switcher)
                ).setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, SpeakerActivity.class);
        spec = tabHost.newTabSpec("speakers").setIndicator(
                new MyView(this, R.drawable.speaker_switcher)
                ).setContent(intent);
        tabHost.addTab(spec);
        

        tabHost.setOnTabChangedListener(this);

        tabHost.setCurrentTab(0);
    }

    private class MyView extends LinearLayout {

        public MyView(Context c, int drawable) {
            super(c);
            
            ImageView iv = new ImageView(c);
            iv.setImageResource(drawable);

            setOrientation(LinearLayout.VERTICAL);
            addView(iv);
            
            
            
        }
    }

	@Override
	public void onTabChanged(String tabId) {

		if (tabId == "dashboard") {
			
		} else if (tabId == "test") {
			
		}
		
	}


}
